package arraylist;

import java.util.ArrayList;

//表示一张扑克牌
class Card{
    //表示数值
    public String rank;
    //表示花色
    public String suit;

    //构造方法初始化一张牌
    public Card(String rank, String suit){
        this.rank = rank;
        this.suit = suit;
    }

    public String toString(){
        return "(" + suit + rank + ")";
    }
}

public class Game {

    //用顺序表来存储一副扑克牌
    public static ArrayList<Card> createDeck(){
        //创建 deck 来存放一副扑克牌
        ArrayList<Card> deck = new ArrayList<>();
        //表示四种花色花色
        String[] suits = {"♠", "♥", "♣", "♦"};
        for (String suit : suits){
            //处理 2 到 10
            int i = 0;
            for (i = 2; i <= 10; i++){
                Card card = new Card("" + i,suit);
                deck.add(card);
            }
            //处理 J Q K A
            deck.add(new Card("J",suit));
            deck.add(new Card("Q",suit));
            deck.add(new Card("K",suit));
            deck.add(new Card("A",suit));
        }
        return deck;
    }
    //创建一个顺序表
    //表示四种花色花色
    public static void main(String[] args) {
        //Card card = new Card("A","♥");
        //System.out.println(card);
        ArrayList<Card> deck = createDeck();
        System.out.println(deck);
    }
}
